import * as VueI18n from 'vue-i18n'
import messages from './messages.js'

const initI18n = (projectMessages) => {

    const totalMessages = {
        zh: {
            ...messages.zh,
            ...projectMessages.zh
        },
        en: {
            ...messages.en,
            ...projectMessages.en
        }
    }

    const i18n = VueI18n.createI18n({
        legacy: false,
        locale: 'zh',
        fallbackLocale: 'zh',
        messages: totalMessages,
    })

    return i18n
}

export default initI18n